<template>
  <h1>{{ msg }}</h1>
  <button @click="send">发送</button>
</template>

<script setup>
import { defineProps, onMounted } from 'vue'
import myWebsokt from './websokt.js'

defineProps({
  msg: String
})
let ws = null
function send() {
  ws.send('1231212')
}
function wsMessage(data) {
  console.log(data);
}
onMounted(() => {
  ws = new myWebsokt('ws://82.157.123.54:9010/ajaxchattest', wsMessage)
  ws.send('121212')
})

</script>

<style scoped>
a {
  color: #42b983;
}
</style>
